/*
 * This computer program is the confidential information and proprietary trade
 * secret of Apptonelabs, Inc. Possessions and use of this program must
 * conform strictly to the license agreement between the user and
 * Apptonelabs, Inc., and receipt or possession does not convey any rights
 * to divulge, reproduce, or allow others to use this program without specific
 * written authorization of Apptonelabs, Inc.
 * 
 * Copyright (c) 2012-2015 Apptonelabs, Inc. All Rights Reserved.
 */
package com.apptonelabs.vnc.vphone;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

//
// The panel which implements the Relogin button
//

class ReloginPanel extends Panel implements ActionListener {
	Button reloginButton;
	Button closeButton;
	VPhone viewer;

	//
	// Constructor.
	//
	public ReloginPanel(VPhone v) {
		viewer = v;
		setLayout(new FlowLayout(FlowLayout.CENTER));
		reloginButton = new Button("Login again");
		add(reloginButton);
		reloginButton.addActionListener(this);
		if (viewer.inSeparateFrame) {
			closeButton = new Button("Close window");
			add(closeButton);
			closeButton.addActionListener(this);
		}
	}

	//
	// This method is called when a button is pressed.
	//
	public synchronized void actionPerformed(ActionEvent evt) {
		if (viewer.inSeparateFrame)
			viewer.vncFrame.dispose();
		if (evt.getSource() == reloginButton)
			viewer.getAppletContext().showDocument(viewer.getDocumentBase());
	}
}
